<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<c:if test="${sessionScope.user.userName != null }">
		欢迎 <a href="ShowOwnAction.do?method=post">${sessionScope.user.userName }</a>
	</c:if>
	<!-- 
	
	<form action="">
		<input name="userName" type="hidden" value="${user.userName }">
		<input type="submit" value="查看">
	</form>
	 -->
	<p></p>
	<p>${requestScope.result}</p>
	<a href="Jsp/Login.jsp">返回登录页面</a>
	<c:choose>
		<c:when test="${sessionScope.list.size() != 0 }">
			<table>
				<thead>
					<tr>
						<td>编号</td>
						<td>用户名</td>
						<td>密码</td>
						<td>邮箱</td>
						<td>操作</td>
					</tr>
				</thead>
				
				<tbody>
				<%-- 
					<c:forEach items="${list}" var="user">
							<td>${user.userName }</td>
							<td>${user.passWord }</td>
							<td>${user.email }</td>
				 --%>
					<s:iterator var="user" value="#session.list" status="status">
						<tr>
							<td><s:property value = "#status.count"/></td>
							<td><s:property value="userName"/></td>
							<td><s:property value="passWord"/></td>
							<td><s:property value="email"/></td>
							<td>
								<form action="UserAction_del.do">
									<input name="id" type="hidden" value="<s:property value="id"/>">
									<input type="submit" value="删除">
								</form>
							</td>
						</tr>
					</s:iterator>
			<%-- 
									<input name="userName" type="hidden" value="${user.userName }">
					</c:forEach>
			 --%>		
				</tbody>

			</table>
		</c:when>
		<c:otherwise>
			<p>无用户数据</p>
		</c:otherwise>
	</c:choose>


</body>
</html>